﻿<?xml version="1.0" encoding="utf-8"?>
<CodeSnippet Format="1.0.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <Header>
    <Title>ExecuteArithOnCSharp</Title>
    <Author>作者</Author>
    <Shortcut>ExecuteArithOnCSharp</Shortcut>
    <Description>ExecuteArithOnCSharp</Description>
    <SnippetTypes>
      <SnippetType>SurroundsWith</SnippetType>
      <SnippetType>Expansion</SnippetType>
    </SnippetTypes>
  </Header>
  <Snippet>
    <Declarations>
      <Literal>
        <ID>ExecuteArithOnCSharp</ID>
        <Default>ExecuteArithOnCSharp</Default>
      </Literal>
    </Declarations>
    <Code Language="CSharp">
      <![CDATA[ExecuteResultEx<ArithNodeCheckResult> er = new ExecuteResultEx<ArithNodeCheckResult>();
            XXXXXCheckResult ar = new XXXXXCheckResult(this)
            {
                Uid = Guid.NewGuid()
            };
            er.OutValue = ar;
            try
            {
                if (!Enable)
                {
                    ar.CheckResult = 1;
                    ar.ExecuteTimeSpan = 0;
                    ar.ExecuteMsg = "未使能";
                }
                else
                {
                    if (image == null || !image.CheckImageIsValid())
                        throw new ArgumentNullException("image");
                    RectangleF rect = Rectangle.Empty;
                    float angle = 0f;
                    var br = GetRoi(imageRoi, results, out rect, out angle, editProject);
                    if (!br)
                    {//定位失败，此算子不执行,并且忽略此结果
                        ar.CheckResult = 0;
                        ar.ExecuteTimeSpan = 0;
                        ar.ExecuteMsg = "定位算子无效,忽略此算子";
                        return er;
                    }
                    #region //TODO:

                    #endregion
                }
            }
            catch (Exception ex)
            {
                er.Ex = ex;
                er.Msg = ex.Message;
                er.Success = false;
                if (er.OutValue == null)
                {
                    er.OutValue = new PreprocessArithNodeCheckResult(this)
                    {
                        Uid = Guid.NewGuid(),
                        ExecuteMsg = ex.Message
                    };
                }
                er.OutValue.CheckResult = -2;
            }
            finally
            {
                er.EndTime = DateTime.Now;
                er.Stop();
                this.CheckResult = er.OutValue.CheckResult;
                this.TimeSpanD = er.TimeSpan;
                this.ExecuteMsg = er.OutValue.ExecuteMsg;
            }
            return er;]]>
    </Code>
  </Snippet>
</CodeSnippet>